#include<iostream>
using namespace std;
#include<fstream>
#include<cmath>

#include"library.h"

double f(double x){
	return exp(-x);
}

int main(){

	int i, j, N=1E6, n=100;
	double x, a=0, b=10, h=(b-a)/n;
	int * count = new int [n]; for(i=0;i<n;i++) count[i] = 0;

	srand(time(NULL));

	for(i=0;i<N;i++){
		x = gnr_rand(a, b, f, 1);
		j = (int)((x-a)/h);
		if(j<n) count[j] ++;
	}
	ofstream fout("exe3.txt");
	for(i=0;i<n;i++) fout<< a + (i+0.5)*h<<"\t"<<(double)count[i]/N/h<<endl;
	fout.close();
	return 0;
}
